package com.example.yls.demoa;

import android.os.Binder;

import java.text.SimpleDateFormat;
import java.util.Date;

public class MyBinder extends Binder {
    public int add(int a, int b){
        return a + b;
    }

    // 显示当前日期（年月日时分秒）
    public String getTime(){
        Date date = new Date();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        return format.format(date);
    }

    public String reverseStr(String str){
        String[] words = str.split(" ");

        StringBuffer resultBuffer = new StringBuffer();
        for(String word : words){
            StringBuffer wordBuffer = new StringBuffer(word);
            resultBuffer.append(wordBuffer.reverse()).append(" ");
        }
        return  resultBuffer.toString();
    }

}
